<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$JO["artistinfo"]= JO( array( "EN" => "Artist Information","VI"=>"Thông Tin Ca Sĩ") );
$JO["birth"]= JO( array( "EN" => "Birth","VI"=>"Ngày Sinh") );
$JO["nation"]= JO( array( "EN" => "Nation","VI"=>"Quốc Gia") );
$JO["autonym"]= JO( array( "EN" => "Autonym","VI"=>"Tên Thật") );
$JO["artist"]= JO( array( "EN" => "Artist","VI"=>"Ca Sĩ") );



$JO["content"]= JO( array( "EN" => "Content","VI"=>"Mô Tả") );
$JO["view"]= JO( array( "EN" => "View","VI"=>"Xem") );

$JO["isempty"]= JO( array( "EN" => "is empty.","VI"=>"đang cập nhật.") );
?>

<span id="JO_artist_content">
<div style="float: left;margin-bottom: 8px; width: 472px;">
    <span id="JO_artistloadding">
    <?
    $artistpage=isset($_REQUEST["artistpage"])?$_REQUEST["artistpage"]:1;
    $artistnum=10;
        $dataartist=ringbacktoneModule::getArtists(($artistpage-1),$artistnum);
    if($dataartist==null){
        echo "Data is updating.";
    }else{
        foreach ($dataartist as $rowartist){
            ?>
            <div class="JO_album_item">
                <img class="imgalbumi" src="<?=(isset($rowartist["image"])?$rowartist["image"]:"JO_images/noartistimages.jpg")?>" />
                <div class="mar8i"></div>
                <div class="JO_albumcontent">
                    <div style="width: 252px;position: relative;" class="text">
                        <?=$JO["artist"]?> : <a href="?JO_unit=001_artist&artist=<?=md5($rowartist["key"])?>"><?=(isset($rowartist["name"])?$rowartist["name"]:"[Artist name is empty]")?></a>

                    </div>
                    <div class="JO_album_release">
                        <?=$JO["birth"]?> : <?=isset($rowartist["birth"])?$rowartist["birth"]:$JO["isempty"]?>
                    </div>
                    <div style="width: 372px;position: relative;" class="text">
                        <?=$JO["autonym"]?> : <?=isset($rowartist["autonym"])?$rowartist["autonym"]:$JO["isempty"]?>
                        <div class="JO_album_view">
                            <?=$JO["nation"]?> : <?=isset($rowartist["nation"])?$rowartist["nation"]:$JO["isempty"]?>
                        </div>
                    </div>
                    <div style="width: 372px;" class="text">
                        <?=$JO["content"]?> : <?=isset($rowartist["content"])?$rowartist["content"]:$JO["isempty"]?>
                    </div>
                </div>

            </div>
            <?
        }
        ?>
        
        
    </span>
    <div style="text-align: center;float: left;
width: 464px;line-height: 24px;margin-top: 4px;">
        <?
        if($dataartist!=null){
            $npages=ringbacktoneModule::getArtists_numpage($artistnum);
            $page=$artistpage;
            if($npages>1){

                if($page-5>1) echo "...";
                for($i=$page-5;$i<=($page+5);$i++){
                    if($i>0 && $i<=$npages){
                    echo "<a href='#i' class='JO_pagesi".(($i==$page)?" pageactive":"")."'>$i</a>";
                    }
                }
                if($page+4<$npages) echo "...";


            }
        }
        ?>

    </div>
        <?
    }
    ?>

</div>
</span>
<script>
function sendurl(p){
    var url="controller/JO_ajax_navigation.php?JO_controller=JO_ringbacktoneController";
    url+="&JO_action=show_artists";
    url+="&artistpage="+p;
    
    $("#JO_artistloadding").html("<div style='text-align: center;padding: 8px 0px;width:472px;'><img src='JO_ICON/ajax-loader2.gif' alt=''/></div>");

    $('#JO_artist_content').load(url,
        function(){
            //initpageclick();

        }
    );
}
function initpageclick(){
    $(".JO_pagesi").click(
        function(){
            var telco=$(".activetab").attr('id');
            sendurl($(this).html(),telco);
        }
    );
    $(".imgalbumi").hover(
        function(){
            //$(this).css("border","1px solid red");
        },
        function(){
            //$(this).css("border","1px solid #222");
        }
    );
    $(".imgalbumi").css("cursor","pointer");
    $(".imgalbumi").click(
        function(){
            location=($(this).next().next().children(":first-child").children(":first-child").attr("href"));
        }

    );

    }
initpageclick();
</script>